<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ page language="java" import="java.util.*,java.text.SimpleDateFormat, com.bean.library.StatisticPaper,
	com.bean.library.Course, com.bean.library.Teacher, com.bean.library.PaperInfo,com.bean.library.StudentExamInfo"%>
<jsp:useBean id="teacher" class="com.bean.library.Teacher" scope="session"></jsp:useBean>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<%
	String teacherName = teacher.getTeacherName();
	HttpSession s = request.getSession();
	PaperInfo paperInfo = (PaperInfo)s.getAttribute("paperInfo");
%>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Exam Info</title>
    <link rel="stylesheet" href="../t_css/t_common.css" type="text/css" />
    <link rel="stylesheet" href="../t_css/t_left_course.css" type="text/css" />
    <link rel="stylesheet" href="../t_css/t_exam_info.css" type="text/css" />
    <script type="text/javascript" src="../scripts/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="../scripts/jquery.animate-colors-min.js"></script>
    <script type="text/javascript" src="../t_scripts/t_navi_common.js"></script>
    <script type="text/javascript">
        $(function () {
            $("#choose_logo").hover(function () {
                $(this).animate({ backgroundColor: '#30A8F4' }, { speed: 1000, queue: false });
            }, function () {
                $(this).animate({ backgroundColor: '#C35A33' }, { speed: 1000, queue: false });
            });
            var btns = ["btn_exam_info", "btn_convert", "btn_check_content"];
            var oldColor;
            $(btns).each(function (key,value) {
                $("." + value).hover(function () {
                    oldColor = $(this).css('background-color');
                    $(this).animate({ backgroundColor: '#30A8F4' }, { speed: 1000, queue: false });
                }, function () {
                    $(this).animate({ backgroundColor: oldColor }, { speed: 1000, queue: false });
                });
            });

            var up_hrefColor = $("#href_up").css('color');
            var down_hrefColor = $("#href_down").css('color');
            $("#page_up").hover(function () {
                $("#href_up").animate({ color: '#000000' }, 0);
            }, function () {
                $("#href_up").animate({ color: up_hrefColor }, 0);
            });

            $("#page_down").hover(function () {
                $("#href_down").animate({ color: '#000000' }, 0);
            }, function () {
                $("#href_down").animate({ color: down_hrefColor }, 0);
            });
        });
    </script>
</head>
<body>
<div id="bigContent">
<div id="head">
    <div id="title">
        <div class="title_left">
            <div class="titleText">Students Online Exam Platform ( For Teacher )</div>
        </div>
        <div class="title_right">
            <div class="avatar"><img src="../image/noavatar.jpg" alt="../image/noavatar.jpg"/></div>
            <div class="userState">
                <div class="userState_big"><a href="#"><%=teacherName %></a></div>
                <div class="userState_small"><a href="/Exam1/servlet/TLogoutServlet">logout</a></div>
            </div>
        </div>
    </div>
    <div id="navi">
    <form id="navi_form" action="/Exam1/servlet/TNaviSelectServlet" method="post">
        <div class="navi_top">
            <ul class="all_navi">
            	<li id="navi1" class="each_navi navi1">Set Questions</li>
                <li id="navi2" class="each_navi navi2">Check Paper</li>
            </ul>
        </div>
        <div class="navi_bottom">
            <ul class="all_courses">
            	<%
            	ArrayList<Course> teacherCourseList = teacher.getTeacherCourseList();
            	Iterator<Course> teacherCourseIt = teacherCourseList.iterator();
            	int courseNum = 0;
            	while(teacherCourseIt.hasNext()){
            		courseNum++;
            		Course course = teacherCourseIt.next();
            		String courseName = course.getCourseName();
            		String courseId = course.getCourseId();
            	
            	%>
            	<li class="each_course course<%=courseNum%>" id="<%=courseId%>"><%=courseName %></li>
            	<%} %>
            </ul>
        </div>
        <input type="hidden" id="operate_type" name="operate_type" value=""/>
        <input type="hidden" id="course_id" name="course_id" value=""/>
        <input type="hidden" id="course_name" name="course_name" value=""/>
    </form> 
    </div>
</div>
<div id="content_exam"  class="boxShadow">
    <div id="choose_logo">
        <div class="choose_logo_text">Check Paper</div>
        <div class="choose_logo_img"></div>
    </div>
    <div id="content_left">
        <div id="courses">
            <div id="courses_title">Courses</div>
            <form id="course_form" action="/Exam1/servlet/TCourseSelectServlet" method="post">
	            <div id="courses_details">
	                <ul id="courses_list">
	                	<%  courseNum = 0;
	                		Iterator<Course> teacherCourseIt1 = teacherCourseList.iterator();
	                		while(teacherCourseIt1.hasNext()){
	                		courseNum++;
	                		Course course = teacherCourseIt1.next();
	                		String courseName = course.getCourseName();
	                		String courseId = course.getCourseId(); %>
	                    <li class="li<%=courseNum%>" id="<%=courseId%>"><div class="each_course_text"><%=courseName %></div></li>
	                    <%} %>
	                </ul>
	                <input type="hidden" id="li_count" value="<%=courseNum%>"/>
	            </div>
	           	<input type="hidden" value="" id="select_course" name="select_course"/>
	            <input type="hidden" value="" id="select_course_name" name="select_course_name"/>
	            <input type="hidden" value="checkpaper" id="test_type" name="operate_type"/>
            </form>
        </div>
    </div>
    <div id="content_right">
    	<%   		
    		String courseName = (String)s.getAttribute("selectedCourseName");
    		String paperName = (String)s.getAttribute("paperName");
		%>    
        <div id="course_name"><%=courseName%></div>
        <div id="paper_name" class="paper_name"><%=paperName%></div>
        <%if(paperInfo!=null){ %>
        <div id="exam_info" class="exam_info">
            <div id="general_info">
                <div class="general_info_title">General Info:</div>
                <ul class="general_info_list">
                	<li>average score:<%=paperInfo.getAverageScore() %></li>
                    <li>The number of reference:<%=paperInfo.getSubmitNum() %></li>
                    <li>Pass number:<%=paperInfo.getPassNum() %></li>
                </ul>
            </div>
            <div id="stu_table" class="stu_table">
                <div class="stu_table_title">Details Table:</div>
                <table border="1" cellspacing="0" cellpadding="0" width="70%" class="table_info">
                	<tr>
                		<td>Student No</td><td>Student Name</td><td>Grade</td>
                	</tr>
                	<%
                	ArrayList<StudentExamInfo> stuExamInfoList = paperInfo.getStudentExamInfoList();
                	Iterator<StudentExamInfo> stuExamInfoIt = stuExamInfoList.iterator();
                	while(stuExamInfoIt.hasNext()){
                		StudentExamInfo studentExamInfo = stuExamInfoIt.next();
                		String studentId = studentExamInfo.getStudentId();
                		String studentName = studentExamInfo.getStudentName();
                		studentExamInfo.getStudentScore();
                	%>
                    <tr>
                		<td><%=studentId%></td><td><%=studentName %></td><td><%=studentExamInfo.getStudentScore()%></td>
                	</tr>
                	<%} %>
                </table>
            </div>
        </div>
        <%} %>
    </div>  
</div>
</div>
</body>
</html>